module teapo.storage.attached.dom { export class LoadStorage implements attached.LoadStorage { private _byName: { [fullPath: string]: HTMLElement; } = {}; private _sizesByName: { [fullPath: string]: { [property: string]: number; }; } = {}; private _parentElement: HTMLElement,
private _document: { createElement(tag: string): HTMLElement; }) { var editedUTCValue = this._parentElement.getAttribute('data-edited-utc'); this.editedUTC = parseInt(editedUTCValue);
catch (parseEditedUTCError) { console.log('parsing editedUTC ' + parseEditedUTCError); load(recipient: LoadStorageRecipient): void { this._loadFromElement(this._parentElement, recipient, dbg);
var updater = new UpdateStorage(this._parentElement, this._byName, this._document);
recipient.completed(updater);
filesByName: { [fullPath: string]: { [propertyName: string]: string; }; }, callback: (error: Error, updater: attached.UpdateStorage) => void): void { this._wipeExistingElement();
this._parentElement.setAttribute('data-edited-utc', editedUTC + ''); this.editedUTC = editedUTC;
for (var fullPath in filesByName) if (filesByName.hasOwnProperty(fullPath)) { var element = UpdateStorage.createElement(this._parentElement, fullPath, this._document);
var pbag = filesByName[fullPath];
for (var pname in pbag) if (pbag.hasOwnProperty(pname)) { UpdateStorage.updateProperty(element, pname, pbag[pname]);
this._byName[fullPath] = element;
var updater = new UpdateStorage(this._parentElement, this._byName, this._document);